"""Training options."""

# 标准库模块
import argparse

parser = argparse.ArgumentParser(description="CoViAR")

# Data.
parser.add_argument('--data-name', type=str, choices=['ucf101', 'hmdb51', 'ylimed'],
                    help='dataset name.')
parser.add_argument('--data-root', type=str,
                    help='root of data directory.')
# example样本
parser.add_argument('--train-list', type=str,
                    help='training example list.')
parser.add_argument('--test-list', type=str,
                    help='testing example list.')

# Model.
parser.add_argument('--representation', type=str, choices=['iframe', 'mv', 'residual'],
                    help='data representation.')
parser.add_argument('--arch', type=str, default="resnet152",
                    help='base architecture.')
# Temporal Segment Networks
parser.add_argument('--num_segments', type=int, default=3,
                    help='number of TSN segments.')
# 重建motion vectors和残差的依赖关系
parser.add_argument('--no-accumulation', action='store_true',
                    help='disable accumulation of motion vectors and residuals.')

# Training.
parser.add_argument('--epochs', default=500, type=int,
                    help='number of training epochs.')
parser.add_argument('--batch-size', default=40, type=int,
                    help='batch size.')
parser.add_argument('--lr', default=0.001, type=float,
                    help='base learning rate.')
parser.add_argument('--lr-steps', default=[200, 300, 400], type=float, nargs="+",
                    help='epochs to decay learning rate.')
parser.add_argument('--lr-decay', default=0.1, type=float,
                    help='lr decay factor.')
# TODO wd是为了防止过拟合
# 在损失函数中, weight decay是放在正则项(regularization)前面的一个系数,
#   正则项一般指示模型的复杂度, 所以weight decay的作用是调节模型复杂度对损失函数的影响,
#   若weight decay很大, 则复杂的模型损失函数的值也就大.
parser.add_argument('--weight-decay', '--wd', default=1e-4, type=float,
                    help='weight decay.')

# Log.
# 默认每5个epochs评测(evaluation)一次
parser.add_argument('--eval-freq', default=5, type=int,
                    help='evaluation frequency (epochs).')
# TODO train/test数据加载
parser.add_argument('--workers', default=8, type=int,
                    help='number of data loader workers.')
parser.add_argument('--model-prefix', type=str, default="model",
                    help="prefix of model name.")
# All command-line args present are gathered into a list.
#   An error message will be generated
#   if there wasn’t at least one command-line argument present.
# 参考https://docs.python.org/3/library/argparse.html
parser.add_argument('--gpus', nargs='+', type=int, default=None,
                    help='gpu ids.')
